<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@page import="org.json.*"%>
<%@page import="com.gzgi.weqs.refquote.ReqPlanApp;"%>
<%@ include file="/include/init_include.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
int pageNo = Request.getInt("page",1);
int pageSize = Request.getInt("pageSize",20);

   String mothod = request.getParameter("mothod").toString() ;
   JSONObject jsonObject = new JSONObject();
   ReqPlanApp app = new ReqPlanApp() ;
   
   if(mothod.equals("list")){
        out.print(app.ListJoson(pageNo,pageSize)) ;
   }else if(mothod.equals("reqplanitem")){
        int planid = Request.getInt("planid") ;
   	    out.print(app.planitemlist(dbi,pageNo,pageSize,planid)) ;
   
   }else if(mothod.equals("parts")){
        int planid = Request.getInt("planid") ;
   		out.print(app.partslist(dbi,pageNo,pageSize,planid)) ;
   }else if(mothod.equals("delete")){
   		String iid = Request.getString("id") ;
	    if(app.itemdelete(dbi,iid)){
	        jsonObject.put("errorCode", "1");
	    }else{
	        jsonObject.put("errorCode", "2");
	    }
        out.print(jsonObject);
   }else if(mothod.equals("inster")){
   		String iid = Request.getString("id") ;
	    if(app.iteminster(dbi,iid)){
	        jsonObject.put("errorCode", "3");
	    }else{
	        jsonObject.put("errorCode", "4");
	    }
        out.print(jsonObject);
   }
      
%>
<%@ include file="/include/init_free.jsp" %>